//app.js
var CryptoJS = require('utils/crypto-js/crypto-js.min.js');
App({
  onLaunch: function() {
    //调用API从本地缓存中获取数据
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
  },
  ecbEncrypto: function (content) {
    var key = CryptoJS.enc.Utf8.parse('1234567812345678')//base64编码
    var srcs = CryptoJS.enc.Utf8.parse(JSON.stringify(content))//base64编码
    var encrypted = CryptoJS.AES.encrypt(srcs, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })
    return encrypted.toString()
  },
  ecbDecrypto: function (cryptoContent) {
    var key = CryptoJS.enc.Utf8.parse('1234567812345678')
    var decrypt = CryptoJS.AES.decrypt(cryptoContent, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })
    return CryptoJS.enc.Utf8.stringify(decrypt).toString()
  },
  globalData: {

  },
  shopId : "",
  colorName : "orange",
  userInfo: {},
  shopInfo: {},
  goodTypes:[],
  memberId: "",
  goodsTypeFilter: "",
  goodsListFilter: "",
  gpid: "",
  userName: '',
  nickname: '',
  //测试
  url: "https://www.xingyuwulian.com/smartLight",
  // url: "http://150.109.121.165:8080/smartLight",
  imageUrl: "https://www.xingyuwulian.com/file/"
})
